﻿package mortal.game.scene3D.display3d.blood.petBlood
{
    import __AS3__.vec.*;

    public class PetBloodFactory extends Object
    {
        private static var _pool:Array = new Array();
        private static const defaultBlood:PetBlood3D = new PetBlood3D();

        public function PetBloodFactory()
        {
            return;
        }// end function

        public static function createBlood3D(param1:int = 0) : PetBlood3D
        {
            var _loc_2:PetBlood3D = null;
            var _loc_3:Vector.<Number> = null;
            if (_pool.length > 0)
            {
                _loc_2 = _pool.pop();
                _loc_2.show();
            }
            else
            {
                _loc_3 = PetBlood3DRender.instance.list1Values;
                if (_loc_3.length >= 100 * 4)
                {
                    _loc_2 = defaultBlood;
                }
                else
                {
                    _loc_2 = new PetBlood3D();
                    _loc_2.reInit(_loc_3);
                }
            }
            return _loc_2;
        }// end function

        public static function disposeBlood3D(param1:PetBlood3D) : void
        {
            if (param1.parent)
            {
                param1.parent = null;
            }
            param1.hide();
            if (param1 != defaultBlood && _pool.indexOf(param1) == -1)
            {
                _pool.push(param1);
            }
            return;
        }// end function

    }
}
